import { getCategoryByIdAPI } from "@/apis/category";
import { useRoute } from "vue-router";
import { onMounted, ref } from "vue";

export function useCategory() {
    const route = useRoute()
    //获取数据(类型)
    const categoryData = ref({})
    const getCategory = async () => {
        const res = await getCategoryByIdAPI(route.params.id)
        categoryData.value = res.data
    }
    onMounted(() => getCategory())
    return{
        categoryData
    }
}
